<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>运用定时器，让 div 一秒后移动</title>
  <style>
    #box {
      width: 50px;
      height: 50px;
      background-color: aqua;
      position: relative;

    }
  </style>
</head>

<body>
  <div id="box">

  </div>
</body>
<script>
  setTimeout(function a() {
    var x = 0;
    var oBox = document.getElementById("box");
    setInterval(function () {
      x++;
      oBox.style.left = x + "px";
    }, 20);
  }, 1000);
</script>

</html>